(function () {
    'use strict';

    angular
    .module('app')
    .factory('APIPreSalesService', APIPreSalesService);

    APIPreSalesService.$inject = ['$http', '$q', '$timeout', 'CacheFactory', 'ENUM'];

    function APIPreSalesService($http, $q, $timeout, CacheFactory, ENUM) {

        var service = new APIEndpoint($http, $q, $timeout, CacheFactory, 'APIPreSalesService');

        service.getPartList = function( params ) {
            return this.fetch( '/weixin/pig/getPartList', params, false, function(res){
                return ENUM.ERROR_CODE.OK == res.data.code ? res.data.data : null;
            });
        };

        service.getOnePart = function( params ) {
            return this.fetch( '/weixin/pig/getOnePart', params, false, function(res){
                return ENUM.ERROR_CODE.OK == res.data.code ? res.data.data : null;
            });
        };

        service.getLiveUrl = function( params ) {
            return this.fetch( '/weixin/home/getLiveUrl', params, false, function(res){
                return ENUM.ERROR_CODE.OK == res.data.code ? res.data.data : null;
            });
        };

        return service;
    }

})();
